package com.chinacoal.microservice.api;

import java.util.List;

import javax.validation.Valid;

import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.api.fallback.WorkflowConfigClientFallback;
import com.chinacoal.microservice.model.common.Entity.InsertValid;
import com.chinacoal.microservice.model.common.Entity.UpdateValid;
import com.chinacoal.microservice.model.wofkflow.QueryProcessBusinessParam;
import com.chinacoal.microservice.model.wofkflow.QueryProcessParam;
import com.chinacoal.microservice.model.wofkflow.entity.CatalogEntity;
import com.chinacoal.microservice.model.wofkflow.entity.ProcessBusinessEntity;
import com.chinacoal.microservice.model.wofkflow.entity.ProcessEntity;
import com.chinacoal.microservice.model.wofkflow.resource.WrapAttribute;
import com.chinacoal.microservice.model.wofkflow.resource.WrapProcessCatalog;
import com.chinacoal.microservice.util.result.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**  
 * @Package: com.chinacoal.microservice.api.WorkflowConfigClient
 * @ClassName: WorkflowConfigClient
 * @ClassDesc: 工作流配置Client
 * @Createby: sunh
 * @CreatedDate: 2019-11-28 21:08:54
 */  
@Api(tags={"流程引擎运行参数管理接口"})
@FeignClient(name = "ccms-workflow", configuration = FeignAutoConfiguration.class, fallback = WorkflowConfigClientFallback.class)
public interface WorkflowConfigClient {

    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.findList
     * @MethodName: findList
     * @MethodDesc: 查询业务流程授权列表
     * @ParamList: {
     *				 @param page
     *				 @param pageSize
     *				 @param queryParam
     *			   }
     * @Return: Result<Page<ProcessBusinessEntity>>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 10:43:45
     */ 
    @ApiOperation(value = "查询业务与流程授权列表")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="path", name = "page", value = "当前页码", required = true, dataType = "int"),
        @ApiImplicitParam(paramType="path", name = "pageSize", value = "每页记录数", required = true, dataType = "int")
    })
    @PostMapping("/workflow/config/processBusiness/findList/{page}/{pageSize}")
    public Result<Page<ProcessBusinessEntity>> findList(@PathVariable("page") Integer page, 
    												    @PathVariable("pageSize") Integer pageSize,
    												    @Valid @RequestBody QueryProcessBusinessParam queryParam);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.findOne
     * @MethodName: findOne
     * @MethodDesc: 查询业务流程授权详情（根据id）
     * @ParamList: {
     *				 @param mapId
     *			   }
     * @Return: Result<ProcessBusinessEntity>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 10:44:50
     */ 
    @ApiOperation(value = "根据授权ID查询业务与流程授权的详情信息")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="path", name = "mapId", value = "主键id", required = true, dataType = "String")
    })
    @GetMapping("/workflow/config/processBusiness/{mapId}")
    public Result<ProcessBusinessEntity> findOne(@PathVariable("mapId") String mapId);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.getProcessByBusinessCode
     * @MethodName: getProcessByBusinessCode
     * @MethodDesc: 查询业务流程授权详情（根据businessCode）
     * @ParamList: {
     *				 @param orgId
     *				 @param sysCode
     *				 @param businessCode
     *			   }
     * @Return: Result<ProcessBusinessEntity>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 11:05:15
     */ 
    @ApiOperation(value = "根据业务编码查询业务与流程授权的详情信息")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="query", name = "orgId", value = "组织id", required = false, dataType = "int"),
        @ApiImplicitParam(paramType="query", name = "sysCode", value = "所属系统编码", required = true, dataType = "String"),
        @ApiImplicitParam(paramType="query", name = "businessCode", value = "业务类型编码", required = true, dataType = "String"),
    })
    @GetMapping("/workflow/config/processBusiness/findOneByCode")
	public Result<ProcessBusinessEntity> getProcessByBusinessCode(@RequestParam(value = "orgId",required = false) Integer orgId,
																  @RequestParam(value = "sysCode",required = true) String sysCode,
																  @RequestParam(value = "businessCode",required = true) String businessCode);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.insert
     * @MethodName: insert
     * @MethodDesc: 新增业务流程授权
     * @ParamList: {
     *				 @param processBusinessEntity
     *			   }
     * @Return: Result<Object>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 11:19:55
     */ 
    @ApiOperation(value = "新增业务与流程授权")
    @PostMapping("/workflow/config/processBusiness")
    public Result<Object> insertProcessBusiness(@Validated({InsertValid.class}) @RequestBody ProcessBusinessEntity processBusinessEntity);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.updateProcessBusiness
     * @MethodName: updateProcessBusiness
     * @MethodDesc: 更新业务流程授权
     * @ParamList: {
     *				 @param processBusinessEntity
     *			   }
     * @Return: Result<Object>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 11:23:56
     */ 
    @ApiOperation(value = "更新业务与流程授权")
    @PutMapping("/workflow/config/processBusiness")
    public Result<Object> updateProcessBusiness(@Validated({UpdateValid.class}) @RequestBody ProcessBusinessEntity processBusinessEntity);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.deleteByIds
     * @MethodName: deleteByIds
     * @MethodDesc: 删除业务与流程授权
     * @ParamList: {
     *				 @param mapIds
     *				 @return Result<Object>
     *			   }
     * @Createby: sunh
     * @CreatedDate: 2019-11-28 21:18:59
     */ 
    @ApiOperation(value = "删除业务与流程授权")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "mapId", value = "主键id", required = true, dataType = "String"),
    })
    @DeleteMapping("/workflow/config/processBusiness/{mapId}")
    public Result<Object> deleteProcessBusiness(@PathVariable("mapId") String mapId);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.getProcessCatalog
     * @MethodName: getProcessCatalog
     * @MethodDesc: 查询流程目录
     * @ParamList: {
     *				 @param page
     *				 @param pageSize
     *				 @param queryParam
     *			   }
     * @Return: Result<Page<CatalogEntity>>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 12:48:06
     */ 
    @ApiOperation(value = "查询流程目录")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="path", name = "page", value = "当前页码", required = true, dataType = "int"),
        @ApiImplicitParam(paramType="path", name = "pageSize", value = "每页记录数", required = true, dataType = "int")
    })
    @PostMapping("/workflow/config/getProcessCatalog/{page}/{pageSize}")
    public Result<Page<CatalogEntity>> getProcessCatalog(@PathVariable("page") Integer page, 
    													 @PathVariable("pageSize") Integer pageSize,
    													 @Valid @RequestBody QueryProcessParam queryParam);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.getProcessList
     * @MethodName: getProcessList
     * @MethodDesc: 查询流程列表
     * @ParamList: {
     *				 @param page
     *				 @param pageSize
     *				 @param queryParam
     *			   }
     * @Return: Result<Page<ProcessEntity>>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 12:48:30
     */ 
    @ApiOperation(value = "查询流程列表")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="path", name = "page", value = "当前页码", required = true, dataType = "int"),
        @ApiImplicitParam(paramType="path", name = "pageSize", value = "每页记录数", required = true, dataType = "int")
    })
    @PostMapping("/workflow/config/getProcessList/{page}/{pageSize}")
    public Result<Page<ProcessEntity>> getProcessList(@PathVariable("page") Integer page, 
    												  @PathVariable("pageSize") Integer pageSize,
    												  @Valid @RequestBody QueryProcessParam queryParam);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.getProcessActivity
     * @MethodName: getProcessActivity
     * @MethodDesc: 查询流程活动列表
     * @ParamList: {
     *				 @param processId
     *				 @return
     *			   }
     * @Return: Result<List<WrapAttribute>>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 12:48:48
     */ 
    @ApiOperation(value = "查询指定流程的活动列表")
    @GetMapping("/workflow/config/getProcessActivity/{processId}")
    public Result<List<WrapAttribute>> getProcessActivity(@PathVariable("processId") Long processId);
    
    /**  
     * @Package: com.chinacoal.microservice.api.WorkflowConfigClient.getProcessTree
     * @MethodName: getProcessTree
     * @MethodDesc: 查询流程树
     * @ParamList: {
     *				 @param processId
     *				 @param parentCatalogId
     *			   }
     * @Return: Result<WrapProcessCatalog>
     * @Createby: sunh
     * @CreatedDate: 2019-12-02 12:49:12
     */ 
    @ApiOperation(value = "查询流程树")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="query", name = "processId", value = "实例id", required = false, dataType = "Long"),
    	@ApiImplicitParam(paramType="query", name = "parentCatalogId", value = "父目录id", required = false, dataType = "String"),
    })
    @GetMapping("/workflow/config/getProcessTree")
    public Result<WrapProcessCatalog> getProcessTree(@RequestParam(value = "processId",required = false) Long processId, 
    												 @RequestParam(value = "parentCatalogId",required = false) String parentCatalogId);
    
    @ApiOperation(value = "获取流程图地址")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="query", name = "processId", value = "实例id", required = false, dataType = "Long"),
    	@ApiImplicitParam(paramType="query", name = "parentCatalogId", value = "父目录id", required = false, dataType = "String"),
    })
    @GetMapping("/workflow/config/getFlowChart")
    public Result<String> getFlowChart(@RequestParam(value = "instanceId",required = true) String instanceId);
}
